package com.jrx.anytxn.investor.service;

import com.jrx.anytxn.common.exception.TxnBizException;
import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.investor.bean.InvestorLoanPlanParamBean;
import com.jrx.anytxn.investor.entity.AmLoanAccountInvestorInfo;
import com.jrx.anytxn.investor.entity.AmLoanMainInvestorInfo;
import com.jrx.anytxn.investor.entity.AmRepaymentPlanInvestorInfo;
import com.jrx.anytxn.param.entity.PrInvestorInterestRate;
import com.jrx.anytxn.param.entity.PrInvestorPenaltyRate;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 联合贷还款计划Service接口
 *
 * @author liuyang
 * @date 2020-05-18
 */
public interface IInvestorRepaymentPlanService {

    /**
     * 生成还款计划
     *
     * @param planParamBean 还款计划参数
     * @param loanMainInvestorInfo 贷款信息
     * @param loanAccountInvestorInfo 贷款账户
     * @return List<AmRepaymentPlanInvestorInfo> 还款计划
     * @throws TxnException
     * @author liuyang
     * @date 2020-05-19
     */
    List<AmRepaymentPlanInvestorInfo> buildRepaymentPlanInvestor(InvestorLoanPlanParamBean planParamBean, AmLoanMainInvestorInfo loanMainInvestorInfo, AmLoanAccountInvestorInfo loanAccountInvestorInfo) throws TxnException;

    /**
     * 计算首期还款日
     *
     * @param loanDate 业务日期
     * @param cycleDay 还款日
     * @param limitDay 间隔时间
     * @return Date首期还款日
     * @author liuyang
     * @date 2020-05-19
     */
    Date computeFirstPaymentDate(Date loanDate, Integer cycleDay, Integer limitDay);

    /**
     * 根据贷款id和客户id查询所有出资方的还款计划
     *
     * @param investorLoanId 资金方贷款id
     * @param customerId 客户id
     * @param tenantId 租户id
     * @param statusList 状态
     * @return List<AmRepaymentPlanInvestorInfo> 还款计划
     * @throws TxnBizException
     * @author liuyang
     * @date 2020-05-21
     */
    List<AmRepaymentPlanInvestorInfo> getPlanList(String investorLoanId, String customerId, String tenantId, List<String> statusList) throws TxnBizException;


    /**
     * 构建还款计划参数
     * @param businessDate
     * @param paymentDateDd
     * @param intervalDays
     * @param repaymentPlanInvestorInfos
     * @return
     */
    InvestorLoanPlanParamBean buildLoanPlanParamBean( Date businessDate, Integer paymentDateDd,Integer intervalDays,List<AmRepaymentPlanInvestorInfo> repaymentPlanInvestorInfos);
}
